Skip to content

gh-131798: JIT: Narrow the return type of _BINARY_OP_SUBSCR_STR_INT to str#132153

Merged
brandtbucher merged 3 commits intopython:mainfrom
tomasr8:jit-narrow-binary-subscr
Apr 8, 2025
Merged

gh-131798: JIT: Narrow the return type of _BINARY_OP_SUBSCR_STR_INT to str#132153
brandtbucher merged 3 commits intopython:mainfrom
tomasr8:jit-narrow-binary-subscr

Conversation

@tomasr8
Copy link
Member

@tomasr8 tomasr8 commented Apr 6, 2025

I tested this by finding another instruction which contains a unicode guard, in this case BINARY_OP_ADD_UNICODE and checking that the guard is removed if one of the operands is the result of _BINARY_OP_SUBSCR_STR_INT. Let me know if there's a better way to test this!

I also noticed that some other uops like _BINARY_OP_ADD_UNICODE check if the operands are constants. Should we add it here as well? I don't know if we gain much from that though, code like 'foo'[0] is not very common.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage topic-JIT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants